<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Sets value of existing class or instance property</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.uopz-set-property" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">uopz_set_property</h1>
  <p class="verinfo">(PECL uopz 5)</p><p class="refpurpose"><span class="refname">uopz_set_property</span> &mdash; <span class="dc-title">Sets value of existing class or instance property</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.uopz-set-property-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>uopz_set_property</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$class</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$property</code></span>
   , <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$value</code></span>
   ) : <span class="type"><span class="type void">void</span></span></div>

  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>uopz_set_property</strong></span>
    ( <span class="methodparam"><span class="type">object</span> <code class="parameter">$instance</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$property</code></span>
   , <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$value</code></span>
   ) : <span class="type"><span class="type void">void</span></span></div>

  <p class="para rdfs-comment">
   Sets the value of an existing static class property, if <code class="parameter">class</code>
   is given, or the value of an instance property (regardless whether the instance property already exists), if <code class="parameter">instance</code>
   is given.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.uopz-set-property-parameters">
  <h3 class="title">参数</h3>
  <dl>

   
    <dt>
<code class="parameter">class</code></dt>

    <dd>

     <p class="para">
      The name of the class.
     </p>
    </dd>

   
   
    <dt>
<code class="parameter">instance</code></dt>

    <dd>

     <p class="para">
      The object instance.
     </p>
    </dd>

   
   
    <dt>
<code class="parameter">property</code></dt>

    <dd>

     <p class="para">
      The name of the property.
     </p>
    </dd>

   
   
    <dt>
<code class="parameter">value</code></dt>

    <dd>

     <p class="para">
      The value to assign to the property.
     </p>
    </dd>

   
  </dl>

 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.uopz-set-property-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   没有返回值。
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.uopz-set-property-examples">
  <h3 class="title">范例</h3>
  <div class="example" id="uopz-get-property.example.basic">
   <p><strong>Example #1 Basic <span class="function"><strong>uopz_set_property()</strong></span> Usage</strong></p>
   <div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">class&nbsp;</span><span style="color: #0000BB">Foo&nbsp;</span><span style="color: #007700">{<br />&nbsp;&nbsp;&nbsp;private&nbsp;static&nbsp;</span><span style="color: #0000BB">$staticBar</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;private&nbsp;</span><span style="color: #0000BB">$bar</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;public&nbsp;static&nbsp;function&nbsp;</span><span style="color: #0000BB">testStaticBar</span><span style="color: #007700">()&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;</span><span style="color: #0000BB">self</span><span style="color: #007700">::</span><span style="color: #0000BB">$staticBar</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;public&nbsp;function&nbsp;</span><span style="color: #0000BB">testBar</span><span style="color: #007700">()&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">bar</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;}<br />}<br /></span><span style="color: #0000BB">$foo&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">Foo</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">uopz_set_property</span><span style="color: #007700">(</span><span style="color: #DD0000">'Foo'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'staticBar'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">10</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">uopz_set_property</span><span style="color: #007700">(</span><span style="color: #0000BB">$foo</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'bar'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">100</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">Foo</span><span style="color: #007700">::</span><span style="color: #0000BB">testStaticBar</span><span style="color: #007700">());<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$foo</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">testBar</span><span style="color: #007700">());<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
   </div>

   <div class="example-contents"><p>以上例程会输出：</p></div>
   <div class="example-contents screen">
<div class="cdata"><pre>
int(10)

</pre></div>
   </div>
  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.uopz-set-property-seealso">
  <h3 class="title">参见</h3>
  <ul class="simplelist">
   <li class="member"><span class="function"><a href="uopz_get_property.html" class="function" rel="rdfs-seeAlso">uopz_get_property()</a> - Gets value of class or instance property</span></li>
  </ul>
 </div>


</div></div></div></body></html>